<?php
/**
 * Created by PhpStorm.
 * User: function
 * Date: 2018-05-02
 * Time: 16:05
 */

namespace app\admin\controller;
use app\common\controller\Admin;
use app\common\model\CatType;
use app\common\model\Type;
use think\Cache;
class System extends Admin
{
    public function index(){
        
        
        return $this->fetch();
        
    }
    
    public function refresh(){
        set_time_limit(0);
        //1.更新前后台菜单对应的关系
        $catTypeList = CatType::all();
        foreach ($catTypeList as $catType){
            $type = Type::get($catType->type_id);
            $catType->type_title = $type->title;
            $catType->isUpdate()->save();
        }
    
        Cache::rm('categoryFoldList23');
        Cache::rm('categoryFoldList13');
        
        
        
        $this->success('操作成功','/system/index');
        
    }
    
}